41C - Email address - CodeForces Solution


expression parsing implementation *1300

Please click on ads to support us..

Python Code:

line = input()
len = len(line)
ans = line[1:len - 1]
ans = ans.replace("dot",".")
ans = ans.replace("at","@",1)
print(f'{line[0:1]}{ans}{line[len - 1:]}')

C++ Code:

#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;

    for (int i=1; i<s.size()-3;i++)
    {
        if (s[i]=='d'&& s[i+1]=='o' && s[i+2]=='t') {s[i]='.'; s.erase(i+1, 2);}
    }

    for (int i=1; i<s.size()-2;i++)
    {
        if (s[i]=='a' && s[i+1]=='t') {s[i]='@'; s.erase(i+1, 1); break;}
    }

    cout <<s;



    return 0;
}


Comments

Submit
0 Comments
More Questions

669A - Little Artem and Presents
691B - s-palindrome
851A - Arpa and a research in Mexican wave
811A - Vladik and Courtesy
1006B - Polycarp's Practice
1422A - Fence
21D - Traveling Graph
1559B - Mocha and Red and Blue
1579C - Ticks
268B - Buttons
898A - Rounding
1372B - Omkar and Last Class of Math
1025D - Recovering BST
439A - Devu the Singer and Churu the Joker
1323A - Even Subset Sum Problem
1095A - Repeating Cipher
630F - Selection of Personnel
630K - Indivisibility
20B - Equation
600B - Queries about less or equal elements
1015A - Points in Segments
1593B - Make it Divisible by 25
680C - Bear and Prime 100
1300A - Non-zero
1475E - Advertising Agency
1345B - Card Constructions
1077B - Disturbed People
653A - Bear and Three Balls
794A - Bank Robbery
157A - Game Outcome